<!DOCTYPE html>
<html lang="en">
<head>
	<meta content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	<meta name="apple-mobile-web-app-capable" content="no" />
	<meta charset="UTF-8">
	<title>发票信息</title>
	<style type="text/css"></style>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.min.js"></script>
	<link href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/addsite.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/all.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Css/SUI.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Font/iconfont.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/css/mobileSelect.css">
</head>
<style type="text/css">
	p.suiTag.top10{margin-top: 0;line-height: 40px;}
	.suiLineInput dl input{margin: 0!important;padding:0;}
	.suiLineInput dl{height: 41px !important}
	.suiTag{margin-bottom: 0}
</style>
<body>
	<p class="suiTag top10">发票信息</p>
	<form id="form">
		<div class="suiLineInput">
			<dl>
				<dt>抬头</dt>
				<dd><input name="look" type="text" value="{{.info.look}}" placeholder="请输入抬头"></dd>
			</dl>
			<dl>
				<dt>税号</dt>
				<dd><input type="text" value="{{.info.ein}}" placeholder="请输入税号" name="ein"></dd>
			</dl>
			<dl>
				<dt>开户银行</dt>
				<dd><input type="text" placeholder="请输入开户行" value="{{.info.bank}}" name="bank"></dd>
			</dl>
			<dl>
				<dt>银行账号</dt>
				<dd><input type="text" placeholder="请输入银行账号" value="{{.info.account}}" name="account"></dd>
			</dl>
			<dl>
				<dt>地址</dt>
				<dd><input type="text" placeholder="请输入地址" value="{{.info.address}}" name="address"></dd>
			</dl>
			<input type="hidden" name="id" value="{{.info.id}}">
		</div>
	</form>
	<button id="sure" style="background-color: #fedb4d; background-image: -webkit-linear-gradient(left,#f46f6f,#e54242); width: 92%; box-shadow: 0 2px 5px rgba(229,66,66,.5); height: 40px; color: #fff; border-radius: 5px; font-weight: 400; font-size: 1pc; letter-spacing: 3px; display: block; margin: auto; margin-top: 20px; margin-bottom: 20px;">确定</button>
</body>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Js/SUI.js"></script>
<!-- <script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/addsite.js"></script> -->
{{template "wechat/public/share.html" .}}
<script type="text/javascript">
function serialize(form){
 var form=document.getElementById(form);
 var arr={};
	for (var i = 0; i < form.elements.length; i++) {
		    var feled=form.elements[i];
		    switch(feled.type) {
		    case undefined:
		    case 'button':
		    case 'file':
		    case 'reset':
		    case 'submit':
		    break;
		    case 'checkbox':
		    case 'radio':
		    if (!feled.checked) {
		    	break;
		    }
		    default:
		    if (arr[feled.name]) {
			    arr[feled.name]=arr[feled.name]+','+feled.value;
		    }else{
			    arr[feled.name]=feled.value;
		    } 
	    }
 	}
 	return arr
 }
document.getElementById("sure").addEventListener("tap", function(){
	var info=serialize('form')
	if (!info.look){
	    mui.toast('请输入抬头!')
	    return false
	}
	if (!info.ein){
	    mui.toast('请输入税号!')
	    return false
	}
	if (!info.bank){
	    mui.toast('请输入开户行!')
	    return false
	}
	if (!info.account){
	    mui.toast('请输入银行账号!')
	    return false
	}
	if (!info.address){
	    mui.toast('请输入地址!')
	    return false
	}
	var that=this
	that.disabled=true
	mui.ajax(window.location.href,{
		data:info,
		type:'post',
		timeout:10000,
		success:function(data){
			if(data==1){
	        mui.alert("","保存成功","确定",function(){
	            window.location.href=document.referrer
	        })
	       }else{
	        mui.alert("网络繁忙,请重试")
	       }
	       that.disabled=false
		},error:function(){
			mui.alert("网络繁忙,请重试")
			that.disabled=false
		}
	})
});
</script>
</html>